// ActionScript file

package framework
{
	import mx.rpc.AsyncToken;
	
	public function chain(...args):AsyncToken
		{
			if (!args.length) return null;
			if (args.length % 2 != 0) throw new ArgumentError("Invalid number of arguments");
			
			var responder:ChainResponder = new ChainResponder;
			responder.chain = args;
			chainInternal(responder);
			return responder.token;
		}
}
